﻿using System;
using System.Web.UI;
using StockholmsStad.Web.UI.Class.Controller;
using StockholmsStad.Web.UI.Class.Facade;
using StockholmsStad.Web.UI.Class.Interfaces;
using StockholmsStad.Web.UI.Class.Model;
using StockholmsStad.Web.UI.Class.Utilities;

namespace StockholmsStad.Web.UI
{
    /// <summary>
    /// 
    /// </summary>
    public partial class FragorOchSvar : Page
    {
        private FAQController controller;

        /// <summary>
        /// Körs när sidan laddas
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                var session = new HttpSessionAdapter(Session);
                var facade = new WebServiceFacade();
                var faqModel = new FAQModel(session, facade);

                ILoginModel loginModel = new LoginModel(session, facade, new HttpContextAdapter(Context));
                controller = new FAQController(faqModel, loginModel);
                rptQuestionList.DataSource = controller.GetTexts();
                rptQuestionList.DataMember = "Header";
                rptQuestionList.DataMember = "Content";
                rptQuestionList.DataBind();
            }
        }
    }
}